using UnityEngine;

namespace VoxelGame.World
{
	public class EnergyFieldFX : MonoBehaviour
	{
		[SerializeField]
		private Material _material;

		[SerializeField]
		private float _speed;

		private float _progress;

		private bool _animating;

		public bool Play()
		{
			if (!_animating)
			{
				_animating = true;
				base.gameObject.SetActive(value: true);
				_progress = 0f;
				_material.SetFloat("_Dissolved", _progress);
				return true;
			}
			return false;
		}

		private void Update()
		{
			if (_animating)
			{
				_progress += _speed * Time.deltaTime;
				_material.SetFloat("_Dissolved", _progress);
				if (_progress > 1f)
				{
					_animating = false;
					base.gameObject.SetActive(value: false);
				}
			}
		}
	}
}
